package com.hc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hc.entity.QcEquipment;
import com.hc.entity.QcEquipmentRecord;
import com.hc.model.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface QcEquipmentMapper extends BaseMapper<QcEquipment> {

    List<QcRecordStatus> getAllQcRecordStatus(@Param("qcRecordStatusModel") QcRecordStatusModel qcRecordStatusModel);


    List<QcEquipment> getQcEquipmentPage(Page page,@Param("qcEquipmentFind") QcEquipmentFind qcEquipmentFind);


    List<QcRecordStatus> getWorkStatus(@Param("qcRecordStatusModel") QcRecordStatusModel qcRecordStatusModel);


    /**
     * 通过开始时间,结束时间, 选择设备类型/设备id/设备名称 来获取设备记录
     */
    List<QcEquipmentRecordModel> findEqDeatil(@Param("qcRecordStatusModel") QcRecordStatusModel qcRecordStatusModel);


    /**
     * 通过开始时间,结束时间, 选择设备类型/设备id/设备名称 来获取设备记录
     */
    List<QcMonitorModel> findEqDeatilForMon(@Param("qcRecordStatusModel") QcRecordStatusModel qcRecordStatusModel);

    /**
     * 通过设备类型id查询所有这种类型的可用设备id集合
     * @param classifyId
     * @return
     */
    /*@Select("select id from qc_equipment where classify_id = #{classifyId} and enable = '0'")
    List<Integer> getAllIdByClassifyIdBy(@Param("classifyId")String classifyId);*/

    /**
     * 通过设备id获取该设备的设备名称
     * @param id
     * @return
     */
    @Select("select device_name from qc_equipment where id = #{id}")
    String selectDeviceNameById(@Param("id") Integer id);

    /**
     * 通过设备id获取该设备的设备编码
     * @param id
     * @return
     */
    @Select("select eq_no from qc_equipment where id = #{id}")
    String selectEqNoById(@Param("id") Integer id);

    /**
     * 根据设备类型id获取所有该设备类型的设备名称和id
     * @param classifyId
     * @return
     */
    @Select("select device_name,id from qc_equipment where classify_id = #{classifyId}")
    List<QcEquipment> getAllDeviceNameForClassifyId(@Param("classifyId")String classifyId);


}
